package com.g.ocache.index;

import java.util.List;

import com.g.ocache.enums.SortingOrder;
import com.g.ocache.enums.VisitingOrder;


/**
 * 
 * @author zhangyf
 * @param <K>
 * @param <V>
 */
public interface Node<K, V> {
	
	/**
	 * 
	 */
	void clear();
	
	Object getId();
	
	List<Object> getIdPath();
	
	boolean isInitialized();
	
	void setInitialized(boolean initialized);
	
	/**
	 * 
	 */
	int getDepth();
	
	Node<K, V> getRoot();
	
	Node<K, V> getParent();

	void removeChild(Object id);
	
	Node<K, V> getChild(Object id);
	
	List<Node<K, V>> getChildren();
	
	void addChild(Object id, Node<K, V> child);
	
	List<Node<K, V>> getChildren(Object from, boolean isFromInclusive, Object to, boolean isToInclusive, SortingOrder order);
	
	/**
	 * 
	 */
	void visit(Visitor<K, V> visitor, VisitingOrder order);
	
	interface Visitor<K, V> {

		void visit(Node<K, V> node);
	}
}
